<#include "../common/header.ftl"/>
<script>
    $(function () {

        $(".showBtn").click(function () {
            // 获取json数据
            var remark = $(this).data("remark");
            layer.open({
                title: "积分明细描述",
                type: 1,
                skin: 'layui-layer-lan', // 样式类名
                closeBtn: 0, // 不显示关闭按钮
                area: ['420px', '240px'], // 宽高
                anim: 3,
                shadeClose: true, // 开启遮罩关闭
                content: '<h4>'+remark+'</h4>'
            });
        });

        // 下拉列表值改变事件
        $("#typeSelect").change(function () {
            // 提交表单
            $("#searchForm").submit();
        });
    });
</script>
</head>
<body>

<div class="container " style="margin-top: 20px">
    <#include "../common/top.ftl"/>
    <div class="row">
        <div class="col-sm-3">
            <#-- 往数据模型中填充一个属性 -->
            <#assign menu="integral"/>
            <#include "../common/menu.ftl"/>
        </div>
        <div class="col-sm-9">
            <div class="row">
                <div class="col-sm-12">
                    <h1 class="page-head-line">积分明细管理</h1>
                </div>
            </div>
            <!--高级查询--->
            <form class="form-inline" id="searchForm" action="/integral/list.do" method="post">
                <input type="hidden" name="currentPage" id="currentPage" value="1">
                <div class="form-group">
                    <label>关键字:</label>
                    <input type="text" class="form-control" id="keyword" name="keyword" value="${(qo.keyword)!}"
                           placeholder="用户/描述"/>
                </div>
                <button class="btn btn-default">
                    <span class="glyphicon glyphicon-search"></span> 查询
                </button>
                <div class="form-group">
                    <label>积分类型:</label>
                    <select class="form-control" name="typeId" id="typeSelect">
                        <option value="-1">全部</option>
                        <#list types as t>
                            <option value="${t.id}">${t.name}</option>
                        </#list>
                    </select>
                    <script>
                        $("#typeSelect").val(${(qo.typeId)!});
                    </script>
                </div>
            </form>

            <table class="table table-striped table-hover">
                <tr>
                    <th>编号</th>
                    <th>用户</th>
                    <th>增减积分</th>
                    <th>积分类型</th>
                    <th>操作时间</th>
                    <th>描述</th>
                </tr>

                <#-- 循环迭代指令 -->
                <#list pageInfo.list as entity>
                    <tr>
                        <td>${entity_index + 1}</td>
                        <td>${entity.user.nickName}</td>
                        <td>${entity.grade}</td>
                        <td>${entity.type.name}</td>
                        <td>${(entity.inputTime?string("yyyy-MM-dd HH:mm:ss"))!"暂无"}</td>
                        <td>
                            <a class="btn btn-info btn-xs showBtn" data-remark='${(entity.remark)!}'>
                                <span class="glyphicon glyphicon-list-alt"></span> 查看描述
                            </a>
                        </td>
                    </tr>
                </#list>
            </table>
            <#include "../common/page.ftl"/>
        </div>
    </div>
</div>

</body>
</html>